class Queue:
    def __init__(self):
        self.items = []

    def is_empty(self):
        return len(self.items) == 0

    def offer(self, item):
        self.items.append(item)

    def pool(self):
        if self.is_empty():
            return None
        return self.items.pop(0)

    def peek(self):
        if self.is_empty():
            return None
        return self.items[0]

    def size(self):
        return len(self.items)

class Queue2:

    def __init__(self, n):
        self.items = [0] * n
        self.l = 0
        self.r = 0

    def is_empty(self):
        return self.l == self.r

    def offer(self, item):
        self.items[self.r] = item
        self.r += 1

    def pool(self):
        if self.is_empty():
            return None
        res = self.items[self.l]
        self.l += 1
        return res

    def peek(self):
        if self.is_empty():
            return None
        return self.items[self.l]

    def size(self):
        return self.r - self.l

class Stack:
    def __init__(self):
        self.items = []

    def is_empty(self):
        return len(self.items) == 0

    def push(self, item):
        self.items.append(item)

    def pop(self):
        if self.is_empty():
            return None
        return self.items.pop()

    def size(self):
        return len(self.items)

    def peek(self):
        if self.is_empty():
            return None
        return self.items[-1]

class Stack2:
    def __init__(self, n):
        self.items = [0] * n
        self.size = 0

    def is_empty(self):
        return self.size == 0

    def size(self):
        return self.size

    def push(self, item):
        self.items[self.size] = item
        self.size += 1

    def pop(self):
        if self.is_empty():
            return None
        res = self.items[self.size - 1]
        self.size -= 1
        return res

    def peek(self):
        if self.is_empty():
            return None
        return self.items[self.size - 1]